﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace Company.UI.CustomControls
{
    public class CustomTextBox : TextBox
    {
        //static CustomTextBox()
        //{
        //    FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomTextBox), new FrameworkPropertyMetadata(typeof(CustomTextBox)));
        //}
        /// <summary>
        /// 标签
        /// </summary>
        public string Label
        {
            get { return (string)GetValue(LabelProperty); }
            set { SetValue(LabelProperty, value); }
        }
        /// <summary>
        /// 单位
        /// </summary>
        public string Unit
        {
            get { return (string)GetValue(UnitProperty); }
            set { SetValue(UnitProperty, value); }
        }

        /// <summary>
        /// 值是否有效
        /// </summary>
        public bool IsValueValid
        {
            get { return (bool)GetValue(IsValueValidProperty); }
            set { SetValue(IsValueValidProperty, value); }
        }
        /// <summary>
        /// 最大值
        /// </summary>
        public object MaxValue
        {
            get { return (object)GetValue(MaxValueProperty); }
            set { SetValue(MaxValueProperty, value); }
        }
        /// <summary>
        /// 最小值
        /// </summary>
        public object MinValue
        {
            get { return (object)GetValue(MinValueProperty); }
            set { SetValue(MinValueProperty, value); }
        }
        public CornerRadius CornerRadius
        {
            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }


        public string InternalText
        {
            get { return (string)GetValue(InternalTextProperty); }
            set { SetValue(InternalTextProperty, value); }
        }


        public string ToolTipComment
        {
            get { return (string)GetValue(ToolTipCommentProperty); }
            set { SetValue(ToolTipCommentProperty, value); }
        }

        public static readonly DependencyProperty ToolTipCommentProperty =
            DependencyProperty.Register("ToolTipComment", typeof(string), typeof(CustomTextBox), new PropertyMetadata(null));


        public static readonly DependencyProperty InternalTextProperty =
            DependencyProperty.Register("InternalText", typeof(string), typeof(CustomTextBox), new PropertyMetadata(""));

        public static readonly DependencyProperty CornerRadiusProperty =
            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(CustomTextBox), new PropertyMetadata(new CornerRadius(0)));

        public static readonly DependencyProperty MinValueProperty =
            DependencyProperty.Register("MinValue", typeof(object), typeof(CustomTextBox), new PropertyMetadata(null));

        public static readonly DependencyProperty MaxValueProperty =
            DependencyProperty.Register("MaxValue", typeof(object), typeof(CustomTextBox), new PropertyMetadata(null));

        public static readonly DependencyProperty IsValueValidProperty =
            DependencyProperty.Register("IsValueValid", typeof(bool), typeof(CustomTextBox), new PropertyMetadata(true));

        public static readonly DependencyProperty UnitProperty =
            DependencyProperty.Register("Unit", typeof(string), typeof(CustomTextBox), new PropertyMetadata(""));

        public static readonly DependencyProperty LabelProperty =
            DependencyProperty.Register("Label", typeof(string), typeof(CustomTextBox), new PropertyMetadata(""));
    }
}
